import { Page } from './page';

export interface Shop {
  id?: number;
  shop_name?: string;
  shop_pic?: string;
  shop_pic_small?: string;
  shop_dispatch_start?: number;
  shop_dispatch_fee?: number;
  is_auto_dispatch_fee?: number;
  auto_dispatch_fee_rule?: ShopDispatchDiscountFeeRule | string;
  shop_opentime?: string;
  shop_opentime_start?: number;
  shop_opentime_close?: number;
  shop_intro?: string;
  shop_address?: string;
  /** 营业状态 */
  is_working?: number;
  /** 主题 */
  theme?: string;
  /** 是否可以预定 */
  can_book?: 1 | 0;
  /** 是否可以快递发货 */
  can_express?: 1 | 0;
  /** 是否可以配送 */
  can_dispatch?: 1 | 0;
  /** 是否可以自提 */
  can_selffetch?: 1 | 0;
  shop_user_id?: number;
  shop_user_phone?: number;
  shop_linkname?: object;
  shop_linktel?: object;
  shop_tel?: string;
  shop_state?: number;
  shop_mode?: string;
  shop_dispatch?: object;
  alltags?: object;
  shop_ready_time?: object;
  shop_desc?: object;
  shop_sold?: number;
  shop_type?: object;
  location_lat?: object;
  location_lng?: object;
  location?: object;
  shop_dispatch_region?: object;
  isdel?: number;
  sold_num?: number;
  mon_sold_num?: number;
  province_code?: object;
  city_code?: object;
  district_code?: object;
  dx_alipay?: number;
  dx_wxpay?: number;
  wxpay?: number;
  codpay?: number;
  can_book_day?: number;
  /** 是否建设完成（0 则弹出新手提示完成配置） */
  is_init?: 0 | 1;
  create_time?: number;
  update_time?: number;
}

export type ShopDispatchDiscountFeeRule = ShopDispatchDiscountFeeRuleItem[];

export interface ShopDispatchDiscountFeeRuleItem {
  at_least: number;
  value: number;
}

export interface ShopDesign {
  sd_id?: number;
  shop_id?: number;
  temp_design?: ShopDesignTab[];
  /**
   * 底栏样式
   * @enum 1 图标加文字
   * @enum 2 平铺图片
   */
  tab_style?: 1 | 2;
  pages?: Page[];
  updateAt?: number;
}

export const InitEmptyShopDesign: ShopDesign = {
  temp_design: [],
  tab_style: 1,
};

export interface ShopDesignTab {
  img: string;
  imgActive: string;
  text?: string;
  color?: string;
  colorActive?: string;
  show?: boolean;
  /**
   * 页面ID
   * [扩展] 使用特定的ID表示内置页面
   * 1 个人中心
   * 2 购物车
   */
  page_id?: string;
  page_title?: string;
  contentType?: string;
}

export interface ShopStore {
  store_id?: number;
  images?: string;
  name?: string;
  address?: string;
  opentime?: string;
  province?: string;
  city?: string;
  district?: string;
  /**
   * 是否展示门店
   */
  hide?: 0 | 1;
}
